#ifndef LGE2D_LOG_TXT_HPP_
#define LGE2D_LOG_TXT_HPP_

#include "log.hpp"
#include <cstdarg>

#include <SFML/System.hpp>

namespace lge2d
{
namespace core
{

class LogTxt: public ILog
{
public:
	using ILog::LogLevel;

	LogTxt(unsigned bufferSize = 2048);
	virtual ~LogTxt();

	virtual void Log(LogLevel level, const char* msg, ...);

	virtual void Info(const char* msg, ...);
	virtual void Warning(const char* msg, ...);
	virtual void Error(const char* msg, ...);
	virtual void Critical(const char* msg, ...);

	virtual void SetLogLevel(LogLevel level);
	virtual LogLevel GetLogLevel() const;

protected:
	char* m_buff;
	unsigned m_bufferSize;

	sf::Clock m_clock;
	sf::Mutex m_mutex;
	LogLevel m_level;

	void LogArgv(LogLevel level, const char* msg, va_list args);
};

} /* namespace core */
} /* namespace lge2d */
#endif /* LGE2D_LOG_TXT_HPP_ */
